#include<iostream>

class Complex
{
public:
Complex():real(0),vir(0){}
Complex(int real,int vir):real(real),vir(vir){}
void show()
{
    std::cout << real << "+" << vir<<"i" << std::endl;
}
Complex operator+(const Complex& c)
{
    Complex result;
    result.real = real + c.real;
    result.vir = vir + c.vir;
    return result;
}
Complex operator-(const Complex& c)
{
    Complex result;
    result.real = real - c.real;
    result.vir = vir - c.vir;
    return result;
}
Complex& operator++() {  // 前置++
    real++;
    vir++;
    return *this;  // 返回当前对象的引用
}
// 后置递增运算符
Complex operator++(int) {  // 后置++
    Complex result = *this;  // 复制当前对象到临时变量
    real++;  // 增加实部
    vir++;   // 增加虚部
    return result;  // 返回原来的对象
}
friend std::ostream &operator<<(std::ostream &os, const Complex &c);
friend std::istream &operator>>(std::istream &is, Complex &c);

private:
int real;
int vir;
};
std::ostream &operator<<(std::ostream &os,const Complex &c)//c++11后ostream不允许拷贝，不能传形参，要用引用
{
    os<<c.real<<"+" << c.vir<<"i" << std::endl;
    return os;
}
std::istream &operator>>(std::istream &is,Complex &c)
{
    is >> c.real >> c.vir;
    return is;
}
int main()
{
    // Complex c1(1, 2);
    // Complex c2(2, 3);
    // // c1.show();
    // // c2.show();
    // Complex& c=++c1;
    // // Complex c3 = c1++;
    // std::cout << c1;
    // operator<<(operator<<(std::cout,c1),c2);
    Complex c;
    std::cin >> c;
    std::cout << c;
    

    return 0;
}